package com.cus.tom.transfer.frag;

import com.cus.tom.transfer.App;
import com.cus.tom.transfer.bean.FileType;
import com.cus.tom.transfer.bean.MediaData;
import com.cus.tom.transfer.utils.SaveUtils;
import com.hjq.permissions.Permission;
import com.hjq.permissions.XXPermissions;

import java.util.Collections;
import java.util.List;

public class RecordVideoFragment extends RecordImgFragment {
    public RecordVideoFragment(int type) {
        super(type);
    }

    @Override
    protected List<MediaData> getMediaData() {
        if (!XXPermissions.isGranted(getActivity(), Permission.MANAGE_EXTERNAL_STORAGE)) {
            return Collections.emptyList();
        }
        return dao.getAllByType(FileType.VIDEO);
    }

    @Override
    protected void saveFile(MediaData data) {
        SaveUtils.saveAudioToAlbum(App.getApp(), data.getPath());
    }
}
